<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/User.Master" Theme="LoginTheme"
    Inherits="System.Web.Mvc.ViewPage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<script runat="server">

    protected void Login1_LoggedIn(object sender, EventArgs e)
    {
        if (Roles.IsUserInRole(Login1.UserName, "admin"))
        {
            Response.Redirect("/Admin");
        }
        else if (Roles.IsUserInRole(Login1.UserName, "professor"))
        {
            Response.Redirect("/Prof");
        }
        else
        {
            Response.Redirect("/Home");
        }

    }

</script>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Login
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div style="width: 80%; margin: 0 auto;">
                <asp:Login ID="Login1" runat="server" OnLoggedIn="Login1_LoggedIn" TabIndex="2000">
                    <LayoutTemplate>
                        <div id="login-box">
                            <h2 align="center">
                                Log In</h2>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            Curriculum - Management
                            <br />
                            <br />
                            <div class="login-box-name" style="margin-top: 20px;">
                                <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" TabIndex="10">User Name:</asp:Label></div>
                            <div class="login-box-field" style="margin-top: 20px;">
                                <asp:TextBox ID="UserName" CssClass="form-login" runat="server" MaxLength="2500"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                    ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
                            </div>
                            <div class="login-box-name">
                                <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label></div>
                            <div class="login-box-field">
                                <asp:TextBox ID="Password" CssClass="form-login" runat="server" TextMode="Password"
                                    MaxLength="2500"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                    ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
                            </div>
                            <br />
                            <span class="login-box-options">
                                <asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." />
                            <br />
                            </span>
                            <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                            <br />
                            <br />
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Login" ValidationGroup="Login1">
                                <asp:Image ID="Image1" runat="server" SkinID="loginImg" />
                            </asp:LinkButton>
                            &nbsp;&nbsp;&nbsp;
                        </div>
                    </LayoutTemplate>
                </asp:Login>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" runat="server"
        TargetControlID="UpdatePanel1">
        <Animations>
            <OnUpdating>                
                <FadeOut minimumOpacity=".5" />
            </OnUpdating>
            <OnUpdated>
                <FadeIn minimumOpacity=".5" />
            </OnUpdated>
        </Animations>
    </asp:UpdatePanelAnimationExtender>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <img style="margin-left: 50px" src="../../App_Themes/AdminTheme/images/ajax-loader.gif" />
        </ProgressTemplate>
    </asp:UpdateProgress>
</asp:Content>
